<script>
  var repeatedCharacter = function (s) {
    const obj = {};
    for(let i = 0;i<s.length;i++){
      const item = s[i];
      if(obj[item]){
        return item;
      }else{
        obj[item] = true;
      }
    }
  };
  console.log(repeatedCharacter("abccbaacz"));
</script>